home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / ClassDay.dxr / Internal_6_waste cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.0 KB  |  72 lines

  1. property spriteNum, undercard, location, motion
  2. global waste, equal, currentsel, getlist, godlist, foundation, tableau, points
  3.  
  4. on beginSprite me
  5.   waste = new(script("card pile"))
  6.   undercard = sprite(11)
  7.   location = sprite(spriteNum).loc
  8. end
  9.  
  10. on mouseDown me
  11.   if waste.getcardcount() > 0 then
  12.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  13.     sprite(spriteNum).locZ = spriteNum + 1000
  14.     getlist = waste
  15.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  16.     if waste.getcardcount() > 1 then
  17.       undercard.member = member(waste.cards[waste.getcardcount() - 1].membername, "playing cards")
  18.     else
  19.       undercard.member = member("empty", "playing cards")
  20.     end if
  21.   end if
  22. end
  23.  
  24. on moving me
  25.   if the mouseDown then
  26.     sprite(spriteNum).loc = the mouseLoc
  27.   else
  28.     if the mouseUp then
  29.       sprite(spriteNum).locZ = spriteNum
  30.       motion.forget()
  31.       abort()
  32.     end if
  33.   end if
  34. end
  35.  
  36. on mouseUp me
  37.   if equal then
  38.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  39.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  40.     godlist.addCard(currentsel)
  41.     sprite(spriteNum).loc = location
  42.     waste.cards.deleteOne(waste.getlastcard())
  43.     if objectp(foundation[sprite(currentsel).row]) then
  44.       points = points + 10
  45.     end if
  46.     equal = 0
  47.     currentsel = 0
  48.     godlist = VOID
  49.     getlist = VOID
  50.     repeat with i = 93 to 96
  51.       if tableau[sprite(i).row].getcardcount() = 0 then
  52.         next repeat
  53.       end if
  54.       sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  55.     end repeat
  56.     checkwin()
  57.     if waste.cards.count > 0 then
  58.       sprite(spriteNum).member = member(waste.getlastcard().membername, "playing cards")
  59.     else
  60.       if waste.cards.count = 0 then
  61.         sprite(spriteNum).member = member("empty", "playing cards")
  62.       end if
  63.     end if
  64.   else
  65.     if not equal then
  66.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  67.       getlist = VOID
  68.       sprite(spriteNum).loc = location
  69.     end if
  70.   end if
  71. end
  72.